﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using T4UtilityBelt.Writers;

namespace T4UtilityBelt.UxDesigns.Bindings.Windows
{
    public class BindingRenderer : IBindingRenderer
    {
        private static string Render(Binding binding)
        {
            if (binding == null)
                return null;

            StringBuilder sb = new StringBuilder();

            sb.Append("{");

            sb.Append("Binding ");
            sb.Append(binding.SourcePropertyPath);

            if (binding.Mode != BindingMode.Default)
            {
                sb.Append(", Mode=");
                sb.Append(binding.Mode);
            }

            sb.Append("}");

            return sb.ToString();
        }

        public void Render(CodeWriter writer, string property, Binding binding)
        {
            writer.WriteAttribute(property, Render(binding));
        }
        
        public void RenderBindingsAttribute(CodeWriter codeWriter, BindingDictionary bindings)
        {
            throw new NotImplementedException();
        }
    }
}
